<?php

?><h2><?php  echo __('Character details'); ?></h2><?php
echo $this->Form->create('Character', array('inputDefaults' => array(
				'label' => false,
				'div' => false
				)));
?><div class="characters form" style="float:right; width:33%;">
	<dl>
		<dt><?php echo __('Player'); ?></dt>
		<dd>
			<?php echo $this->Html->link($this->data['Player']['name'], array('controller' => 'players', 'action' => 'view', $this->data['Player']['id'])); ?>
			&nbsp;
		</dd>

		<dt><?php echo __('Chin'); ?></dt>
		<dd style="padding-right: 10em">
<?php echo $this->Form->input('chin'); ?>
<div style="display:inline-block; margin: -1em -10em -1em 0; width: 9em;">
<?php echo $this->Form->input('status'); ?>
<?php $this->Js->buffer('$("#CharacterStatus").combobox();', true); ?>
</div>
		</dd>

		<dt><?php echo __('Name'); ?></dt>
		<dd><?php echo $this->Form->input('name'); ?></dd>

		<dt><?php echo __('Faction'); ?></dt>
		<dd><?php echo $this->Form->input('faction'); ?></dd>
<?php $this->Js->buffer('$("#CharacterFaction").combobox();', true); ?>

		<dt><?php echo __('Element'); ?></dt>
		<dd><?php echo $this->Form->input('element'); ?></dd>
<?php $this->Js->buffer('$("#CharacterElement").combobox();', true); ?>

		<dt><?php echo __('Faith'); ?></dt>
		<dd><?php echo $this->Form->input('faith'); ?></dd>

		<dt><?php echo __('Group'); ?></dt>
		<dd><?php echo $this->Form->input('group'); ?></dd>
	</dl>
</div>

<?php

$this->TabPanel->tabStart(__('Skills'));
echo "<div id=\"addSkill\" class=\"ui-widget-content ui-corner-all\" style=\"display: inline-block;\">\n";
echo $this->Form->input("Skill", array('empty' => true, 'value'=>''));
$this->Js->buffer('$("#SkillSkill").combobox();', true);
echo $this->Form->button(__('Add'), array('class'=>'jqui'));
echo "</div>\n";

echo "<div style=\"display: inline-block; padding: 0.5em 0px; float: right;\">\n";
echo $this->Form->button(__('Remove'), array('class'=>'jqui'));
echo $this->Form->button(__('Edit'), array('class'=>'jqui'));
echo $this->Form->button(__('Print'), array('class'=>'jqui','disabled'));
echo "</div>\n";

$this->Js->buffer('$(".jqui").button();', true);

echo "<dl>\n";
$xpsum = 0;
foreach($this->data['Skill'] as $skill) {
	echo "<dt>" . h($skill['cost']) . "</dd>\n";
	echo "<dd>" . h($skill['name']) . "</dt>\n";
	echo $this->Form->hidden('Skill.Skill.', array('value'=>$skill['id']));
	$xpsum += $skill['cost'];
}
echo "<dt>" . h($this->data['Character']['xp'] - $xpsum) . "</dd>\n";
echo "<dd>" . __('XP Saved') . "</dt>\n";
echo "<dt>" . h($this->data['Character']['xp']) . "</dd>\n";
echo "<dd>" . __('XP Total') . "</dt>\n";
echo "</dl>\n";
$this->TabPanel->tabEnd();

$this->TabPanel->tabStart(__('Items'));
echo "<div id=\"addItem\">\n";
echo $this->Form->input('ITIN');
echo $this->Form->input('Name');
echo "</div>\n";
echo $this->Form->button(__('Remove'));
echo $this->Form->button(__('Edit'));
echo $this->Form->button(__('Print'));
# TODO lijst van items
# voorzien van een hidden check buttons (voor Remove/Edit/Print)
$this->TabPanel->tabEnd();

$this->TabPanel->tabStart(__('Powers & Conditions'));
echo "<div id=\"addPower\">\n";
echo $this->Form->input('POIN');
echo $this->Form->input('Name');
echo "</div>\n";
echo $this->Form->button(__('Remove'));
echo $this->Form->button(__('Edit'));
echo $this->Form->button(__('Print'));
# TODO lijst van powers
# voorzien van een hidden check buttons (voor Remove/Edit/Print)
$this->TabPanel->tabEnd();

$this->TabPanel->tabStart(__('Comments'));
echo $this->Form->input('comments', array('type' => 'textarea'));
$this->TabPanel->tabEnd();

?>
<div class="leftside" style="float: left; width: 63%;">
<?php echo $this->TabPanel->get(); ?>
</div>

<?php echo $this->Form->end();?>
